package priv.dajie.tzzq.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import priv.dajie.tzzq.dao.BuffCsgoMapper;
import priv.dajie.tzzq.service.PlatformCsgoService;
import priv.dajie.tzzq.spider.model.CsgoItemInfo;
import priv.dajie.tzzq.spider.model.PlatformCsgoItem;

/**
 * @ClassName BuffCsgoServiceImpl
 * @Description
 * @Author dajie
 * @Date 2019/11/10 10:28 上午
 * @Version V1.0
 **/
public class BuffCsgoServiceImpl implements PlatformCsgoService {

    @Autowired
    private BuffCsgoMapper buffCsgoMapper;

    @Override
    public boolean addItem(PlatformCsgoItem csgoItem) {
        return buffCsgoMapper.addItem(csgoItem);
    }

    @Override
    public boolean updateItem(PlatformCsgoItem csgoItem) {
        return buffCsgoMapper.updateItem(csgoItem);
    }

    @Override
    public boolean addInfo(CsgoItemInfo csgoItemInfo) {
        return buffCsgoMapper.addInfo(csgoItemInfo);
    }

    @Override
    public boolean updateInfo(CsgoItemInfo csgoItemInfo) {
        return buffCsgoMapper.updateInfo(csgoItemInfo);
    }

    @Override
    public boolean autoAddItem(PlatformCsgoItem csgoItem) {
        if(!updateItem(csgoItem)){
            return addItem(csgoItem);
        }
        return true;
    }

    @Override
    public boolean autoAddInfo(CsgoItemInfo csgoItemInfo) {
        if(!updateInfo(csgoItemInfo)){
            return addInfo(csgoItemInfo);
        }
        return true;
    }
}
